package com.test.proxy;

import com.test.proxy.cglib.CglibProxy;
import com.test.proxy.java.JdkProxy;
import com.test.proxy.target.UserService;
import com.test.proxy.target.UserServiceImpl;

/**
 * Created with IntelliJ IDEA.
 * Description:
 *
 * @author lzy
 * @create 2020-06-17 下午12:40
 */
public class App {
    public static void main(String[] args) {
        UserService userService = new UserServiceImpl();
        final UserService proxy = (UserService) JdkProxy.getProxy(userService);
        System.out.println(proxy.getUserName());

        UserService proxyService = (UserService) new CglibProxy().getProxy(UserServiceImpl.class);
        System.out.println(proxyService.getUserName());
    }
}
